﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="List.aspx.cs" Inherits="Web.Admin.Page_Channel.List" %>
<%@ Import Namespace="System" %>
<%@ Import Namespace="System.Collections" %>
<%@ Import Namespace="System.Collections.Generic" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Web" %>
<%@ Import Namespace="System.Web.UI" %>
<%@ Import Namespace="System.Web.UI.WebControls" %>

<!DOCTYPE html>

<%="<!--[if IE 8]> <html class=\"ie8 no-js\"> <![endif]-->"%>
<%="<!--[if IE 9]> <html class=\"ie9 no-js\"> <![endif]-->"%>
<%="<!--[if !IE]><!-->"%>
<html>
<%="<!--<![endif]-->"%>
<!-- BEGIN HEAD -->

<head>
    <meta charset="utf-8" />
    <title><%=Evan.Common.CommFun.GetAppSetting("AdminTitle") %> - 后台管理系统</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta content="width=device-width, initial-scale=1" name="viewport" />
    <!-- #include file="../include/com_res_css.inc" -->
    <style type="text/css">
        .tree-list .col-1{ width:6%; text-align:center; }
        .tree-list .col-2{ width:14%; white-space:nowrap;word-break:break-all;overflow:hidden; }
        .tree-list .col-3{ width:46%; white-space:nowrap;word-break:break-all;overflow:hidden; }
        .tree-list .col-4{ width:6%; text-align:center; }
        .tree-list .col-5{ width:8%; text-align:center; }
        .tree-list .col-6{ width:8%; }
        .tree-list .col-7{ width:12%; text-align:center; }
        .table-container ul,li { list-style:none;}
        .table-container ul {  padding-left: 20px; }
    </style>
    
</head>
<!-- END HEAD -->

<body class="page-header-fixed page-sidebar-closed-hide-logo page-content-white">
    <!-- BEGIN HEADER -->

    <!-- #include file="../include/top_bar.inc" -->

    <!-- END HEADER -->
    <!-- BEGIN HEADER & CONTENT DIVIDER -->
    <div class="clearfix"></div>
    <!-- END HEADER & CONTENT DIVIDER -->
    <!-- BEGIN CONTAINER -->
    <div class="page-container">
        <!-- BEGIN SIDEBAR -->

        <!-- #include file="../include/left_menu.inc" -->

        <!-- END SIDEBAR -->
        <!-- BEGIN CONTENT -->
        <div class="page-content-wrapper">
            <!-- BEGIN CONTENT BODY -->
            <div class="page-content">
                <!-- BEGIN PAGE HEADER-->
                <!-- BEGIN THEME PANEL -->
                <!-- #include file="../include/theme_panel.inc" -->
                <!-- END THEME PANEL -->
                <!-- BEGIN PAGE BAR -->
                
                <!-- END PAGE BAR -->
                <!-- BEGIN PAGE TITLE-->
                <h3 class="page-title">栏目管理
                     <% if (GlobalConfigModel.Dev || GlobalConfigModel.IsModuleSystem) { %>
                    <a class="btn btn-primary" href="javascript:AddClick();"><i class="fa fa-plus"></i>&nbsp;&nbsp;&nbsp;增加顶级栏目</a>
                    <%} %>
                </h3>
                <!-- END PAGE TITLE-->
                <!-- END PAGE HEADER-->
                <!-- BEGIN PAGE CONTENT-->

                <div class="table-scrollable">
                    <table class="table table-striped table-bordered table-hover">
                        <thead>
                            <tr>
                                <th scope="col" style="max-width: 45px;width: 45px;text-align: center;">编号</th>
                                <th scope="col">栏目名称</th>
                                <th scope="col" style="max-width: 200px;width: 200px;text-align: center;">发布时间 </th>
                                <th scope="col" style="max-width: 82px;width: 82px;text-align: center;">属性 </th>
                                <th scope="col" style="max-width: 82px;width: 82px;text-align: center;">排序 </th>
                                <th scope="col" style="max-width: 230px;width: 230px;text-align: center;">操作 </th>
                                <% if (GlobalConfigModel.Dev || GlobalConfigModel.IsModuleSystem) { %>
                                <th scope="col" style="max-width: 380px;width: 380px;">快捷设置 </th>
                                <th scope="col" style="max-width: 82px;width: 82px;text-align: center;">字段管理 </th>
                                <%--<th scope="col" style="max-width: 82px;width: 82px;text-align: center;">模块管理 </th>--%>
                                <%} %>
                                <th scope="col" style="max-width: 59px;width: 59px;text-align: center;">预览 </th>
                            </tr>
                        </thead>
                        <tbody>

                            <%--<% 
                                                    List<dynamic> Result = new List<dynamic> ();
                                                    Result = Lists.FindAll(res => res.ParentId == 0); 
                                                %>--%>

                            <% foreach (var item in Channel_List) { %>
                            
                            <tr parentid="<%=item.ParentId %>">
                                <td class="manager_tab_center"><%=item.Id %> </td>
                                <td><%--<i class="fa fa-plus" style=""></i>--%><%=Deep(item.Deep) %> <%=item.Title %></td>
                                <td class="manager_tab_center"><%=item.AddTime.ToString("yyyy-MM-dd HH:mm:ss") %> </td>
                                <td class="manager_tab_center">
                                    <a href="javascript:;" class="btn btn-xs <%=(item.States==0?"red":"default") %> states" data-tip-type="栏目" data-id="<%=item.Id %>" data-title="<%=item.Title %>" data-states="<%=item.States %>">锁定 <i class="fa fa-lock"></i></a>
                                </td>
                                <td class="manager_tab_center">
                                    <div class="btn-group btn-group-xs btn-group-solid">
                                        <input type="text" class="sortid_field" data-id="<%=item.Id %>" value="<%=item.SortId %>" style="display:none;" />
                                        <button type="button" class="btn" title="上移" onclick="UpSortId(this,<%=item.Id %>,<%=item.SortId %>)"><i class="fa fa-arrow-up"></i></button>
                                        <button type="button" class="btn" title="下移" onclick="DownSortId(this,<%=item.Id %>,<%=item.SortId %>)"><i class="fa fa-arrow-down"></i></button>
                                    </div>
                                </td>
                                <td>
                                    <div class="btn-group btn-group-xs btn-group-solid">
                                        <button type="button" class="btn green" onclick="EditClick(<%=item.Id %>)">编辑</button>
                                        <% if (GlobalConfigModel.Dev || GlobalConfigModel.IsModuleSystem) { %><button type="button" class="btn blue" onclick="AddChild(<%=item.Id %>)">添加子分类</button><% } %>
                                        <button type="button" class="btn red del" data-tip-type="栏目" data-id="<%=item.Id %>" data-title="<%=item.Title %>">删除</button>
                                        <% if(item.ParentId>0) {  %><button type="button" class="btn blue-hoki copychannel" data-tip-type="栏目" data-id="<%=item.Id %>" data-title="<%=item.Title %>">复制</button><%} %>
                                    </div>
                                </td>

                                <% if (GlobalConfigModel.Dev || GlobalConfigModel.IsModuleSystem) { %>
                                        <td class="manager_tab_center">
                                            <a href="javascript:;" class="btn btn-xs <%=(item.IsSeo==1?"blue-dark":"default") %> c-quick" data-operat="IsSeo" data-tip-type="SEO" data-id="<%=item.Id %>" data-title="<%=item.Title %>" data-states="<%=item.IsSeo %>">SEO</a>

                                             <a href="javascript:;" class="btn btn-xs <%=(item.ChannelSeo==1?"blue-dark":"default") %> c-quick" data-operat="ChannelSeo" data-tip-type="SEO" data-id="<%=item.Id %>" data-title="<%=item.Title %>" data-states="<%=item.ChannelSeo %>">栏目SEO</a>

                                            <% if (SiteConfig.WebMode==2) { %>
                                            <a href="javascript:;" class="btn btn-xs <%=(item.IsCreatePage==1?"blue-dark":"default") %> c-quick" data-operat="IsCreatePage" data-tip-type="内容" data-id="<%=item.Id %>" data-title="<%=item.Title %>" data-states="<%=item.IsCreatePage %>">生成</a>
                                            <% } %>
                                            <a href="javascript:;" class="btn btn-xs <%=(item.IsIndexNav==1?"blue-dark":"default") %> c-quick" data-operat="IsIndexNav" data-tip-type="内容" data-id="<%=item.Id %>" data-title="<%=item.Title %>" data-states="<%=item.IsIndexNav %>">导航</a>
                                             <a href="javascript:;" class="btn btn-xs <%=(item.FootNav==1?"blue-dark":"default") %> c-quick" data-operat="FootNav" data-tip-type="内容" data-id="<%=item.Id %>" data-title="<%=item.Title %>" data-states="<%=item.IsIndexNav %>">底部</a>

                                            <a href="javascript:;" class="btn btn-xs <%=(item.IsExport==1?"blue-dark":"default") %> c-quick" data-operat="IsExport" data-tip-type="内容" data-id="<%=item.Id %>" data-title="<%=item.Title %>" data-states="<%=item.IsExport %>">导出</a>
                                            <a href="javascript:;" class="btn btn-xs <%=(item.IsVisualEdit==1?"blue-dark":"default") %> c-quick" data-operat="IsVisualEdit" data-tip-type="内容" data-id="<%=item.Id %>" data-title="<%=item.Title %>" data-states="<%=item.IsVisualEdit %>">vEdit</a>
                                            <% if(Evan_BLL.GetHasReleaseTime(item)) { %>
                                            <a href="javascript:;" class="btn btn-xs <%=(item.IsReleaseTime == 1 ? "blue-dark" : "default") %> c-quick" data-operat="IsReleaseTime" data-tip-type="内容" data-id="<%=item.Id %>" data-title="<%=item.Title %>" data-states="<%=item.IsReleaseTime %>">定时发布</a>
                                            <% } %>
                                    </td>
                                    <td class="manager_tab_center">
                                        <% if (item.PageType > 0) { %>
                                            <a href="javascript:;" onclick="JumpAddField(<%=item.Id %>)" class="btn btn-xs " data-id="<%=item.Id %>" data-title="<%=item.Title %>">字段管理 </a>
                                        <%} %>
                                    </td>
                                    <%--<td>
                                        <% if (item.PageType > 0) { %>
                                            <a href="javascript:;" onclick="JumpModuleList(<%=item.Id %>)" class="btn btn-xs " data-id="<%=item.Id %>" data-title="<%=item.Title %>">模块管理 </a>
                                        <%} %>
                                    </td>--%>
                                <%} %>

                                <td class="manager_tab_center">
                                    <% if (!string.IsNullOrEmpty(item.WebPath)) { %>
                                    <a href="<%=item.WebPath %>" target="_blank" class="btn btn-xs">预览 </a>
                                    <%} %>
                                 </td>
                            </tr>
                            
                            <% } %>

                      

                        </tbody>
                    </table>
                </div>

                <%--<div class="table-container">
                    <div class="tree-list">
                        <div class="thead">
                            <div class="col col-1">选择</div>
                            <div class="col col-2">调用名称</div>
                            <div class="col col-3">标题</div>
                            <div class="col col-4">显示</div>
                            <div class="col col-5">默认</div>
                            <div class="col col-6">排序</div>
                            <div class="col col-7">操作</div>
                        </div>
                        <ul>
                            <% foreach (var item in Channel_List) { %>
                            <li class="layer-<%=item.Deep+1 %>">
                                <div class="tbody">
                                    <div class="col col-1">
                                        <a href="nav_edit.aspx?action=Edit&id=1"><%=item.Id %></a>
                                    </div>
                                    <div class="col index col-3">
                                        <a href="nav_edit.aspx?action=Edit&id=1"><%=item.Title %></a>
                                    </div>
                                </div>
                            </li>
                            <% } %>
                        </ul>
                    </div>
                </div>--%>

                <!-- END PAGE CONTENT-->
            </div>
            <!-- END CONTENT BODY -->
        </div>
        <!-- END CONTENT -->

    </div>
    <!-- END CONTAINER -->
    <!-- #include file="../include/footer.inc" -->
    <!-- #include file="../include/com_res_js.inc" -->

    <script type="text/javascript">
        //初始化Tree目录结构
        function initCategoryHtml(parentObj, layNum) {
            $(parentObj).find('li.layer-' + layNum).each(function (i) {
                var liObj = $(this);
                var nextNum = layNum + 1;
                if (liObj.next('.layer-' + nextNum).length > 0) {
                    initCategoryHtml(parentObj, nextNum);
                    var newObj = $('<ul></ul>').appendTo(liObj);
                    moveCategoryHtml(liObj, newObj, nextNum);
                }
            });
        }

        function moveCategoryHtml(liObj, newObj, nextNum) {
            if (liObj.next('.layer-' + nextNum).length > 0) {
                liObj.next('.layer-' + nextNum).appendTo(newObj);
                moveCategoryHtml(liObj, newObj, nextNum);
            }
        }
        //初始化Tree目录事件
        $.fn.initCategoryTree = function (isOpen) {
            var fCategoryTree = function (parentObj) {
                //遍历所有的UL
                parentObj.find("ul").each(function (i) {
                    //遍历UL第一层LI
                    $(this).children("li").each(function () {
                        var liObj = $(this);
                        //判断是否有子菜单和设置距左距离
                        var parentIconLenght = liObj.parent().parent().children(".tbody").children(".index").children(".fa").length; //父节点的左距离
                        var indexObj = liObj.children(".tbody").children(".index"); //需要树型的目录列
                        //设置左距离
                        if (parentIconLenght == 0) {
                            parentIconLenght = 1;
                        }
                        for (var n = 0; n <= parentIconLenght; n++) { //注意<=
                            $('<i class="fa"></i>').prependTo(indexObj); //插入到index前面
                        }
                        //设置按钮和图标
                        //indexObj.children(".fa").last().addClass("fa fa-folder"); //设置最后一个图标
                        //如果有下级菜单
                        if (liObj.children("ul").length > 0) {
                            //如果要求全部展开
                            if (isOpen) {
                                indexObj.children(".fa").eq(-2).addClass("expandable fa fa-minus-square"); //设置图标展开状态
                            } else {
                                indexObj.children(".fa").eq(-2).addClass("expandable fa fa-plus-square"); //设置图标闭合状态
                                liObj.children("ul").hide(); //隐藏下级的UL
                            }
                            //绑定单击事件
                            indexObj.children(".expandable").click(function () {
                                //如果菜单已展开则闭合
                                if ($(this).hasClass("fa-minus-square")) {
                                    //设置自身的右图标为+号
                                    $(this).removeClass("fa-minus-square");
                                    $(this).addClass("fa-plus-square");
                                    //隐藏自身父节点的UL子菜单
                                    $(this).parent().parent().parent().children("ul").slideUp(300);
                                } else {
                                    //设置自身的右图标为-号
                                    $(this).removeClass("fa-plus-square");
                                    $(this).addClass("fa-minus-square");
                                    //显示自身父节点的UL子菜单
                                    $(this).parent().parent().parent().children("ul").slideDown(300);
                                }
                            });
                        } else {
                            indexObj.children(".fa").eq(-2).addClass("fa fa-folder-open visibility-hide");
                        }
                    });
                    //显示第一个UL
                    if (i == 0) {
                        $(this).show();
                        //展开第一个菜单
                        if ($(this).children("li").first().children("ul").length > 0) {
                            $(this).children("li").first().children(".tbody").children(".index").children(".expandable").removeClass("fa-minus-square");
                            $(this).children("li").first().children(".tbody").children(".index").children(".expandable").addClass("fa-plus-square");
                            $(this).children("li").first().children("ul").show();
                        }
                    }
                });
            };
            return $(this).each(function () {
                fCategoryTree($(this));
            });
        }
    </script>
<%--    <script type="text/javascript">
        $(function () {
            //初始化分类的结构
            initCategoryHtml('.tree-list', 1);
            //初始化分类的事件
            $('.tree-list').initCategoryTree(true);
        });
    </script>--%>
</body>

</html>